/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * The software in this package is published under the terms of the GPL v2.0
 * license, a copy of which has been included with this distribution in the
 * LICENSE-GPL.txt file.
 */

package org.cemantika.contextsource;

import org.cemantika.metamodel.structure.ContextSource;
import org.cemantika.metamodel.structure.ContextualElement;
import org.cemantika.metamodel.structure.ContextualEntity;

/**
 * ContextSourceAdapter represents the specification of the communication protocols between the
 * context source and the context manager.
 * 
 * @author andersonfellipe
 */
public interface ContextSourceAdapter<T, E> {

    /**
     * Get the object with the {@link ContextSource} annotation.
     * 
     * @return the {@link ContextSource} to get.
     */
    public T getContextSource();

    /**
     * Represents the registration of a {@link ContextSource} into a {@link ContextSourceAdapter}.
     * 
     * @param contextSource the {@link ContextSource} to register.
     */
    public void setContextSource(T contextSource);

    /**
     * Represents the registration of a {@link ContextualEntity} into a
     * {@link ContextSourceAdapter}.
     * 
     * @param contextualEntity the {@link ContextualEntity} to register.
     */
    public void setContextualEntity(Object contextualEntity);

    /**
     * Represents the update of the {@link ContextualElement} of a {@link ContextualEntity} and
     * implements any transformation between the value and the {@link ContextualElement}.
     * 
     * @param value the value of the {@link ContextualElement} to update.
     */
    public void updateContextualElement(E value);

}
